package admin

import (
	"github.com/gin-gonic/gin"
	"go-api-template/api/http"
	"go-api-template/api/http/v1/admin/resource/article"
	"go-api-template/api/http/v1/admin/resource/tag"
)

func setResourceApi(r *gin.RouterGroup) {
	rg := r.Group("/resource")

	setArticleApi(rg)
	setTagApi(rg)
}

func setArticleApi(r *gin.RouterGroup) {
	rg := r.Group("/article")

	{
		rg.POST("/save", http.Handle(&article.SaveReq{}))
		rg.POST("/list", http.Handle(&article.ListReq{}))
		rg.POST("/delete", http.Handle(&article.DeleteReq{}))
		rg.POST("/save/tag", http.Handle(&article.SaveTagReq{}))
	}
}

func setTagApi(r *gin.RouterGroup) {
	rg := r.Group("/tag")

	{
		rg.POST("/create", http.Handle(&tag.CreateReq{}))
		rg.POST("/list", http.Handle(&tag.ListReq{}))
		rg.POST("/delete", http.Handle(&tag.DeleteReq{}))
	}
}
